Bayes' theorem

In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) is a method of incorporating new knowledge to update the value of the probability of occurence of an event. To that end the theorem gives the relationship between the updated probability P(A|B), the conditional probability of A given the new knowledge B, and the probabilities of A and B, P(A) and P(B), and the conditional probability of B given A, P(B|A). The theorem is named for Thomas Bayes (pronounced /ˈbeɪz/ or "bays").[1] In its most common form, Bayes' theorem is:

P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. \,

Contents

Introductory example

If someone told you he had a nice conversation in the train, the probability it was a woman he spoke with is 50%. If he told you the person he spoke to was going to visit a quilt exhibition, it is far more likely than 50% it is a woman. Call W the event he spoke to a woman, and Q the event "a visitor of the quilt exhibition". Then: P(W)=0.50, but with the knowledge of Q the updated value is P(W|Q) that may be calculated with Bayes' formula as:

P(W|Q)=\frac{P(Q|W)P(W)}{P(Q)}=\frac{P(Q|W)P(W)}{P(Q|W)P(W)%2BP(Q|M)P(M)},

in which M (man) is the complement of W. As P(M)=P(W)=0.5 and P(Q|W)>>P(Q|M), the updated value will be quite close to 1.

Interpretation

Bayes' theorem has two distinct interpretations. In the frequentist interpretation it relates two representations of the probabilities assigned to a set of outcomes (conceptual inverses of each other). Both can be meaningful, so if only one is known Bayes' theorem enables conversion. In the Bayesian interpretation, Bayes' theorem is an expression of how degrees of belief should rationally be updated to account for evidence. The application of this view is called Bayesian inference, and is widely applied in fields including science, engineering, medicine and law.[2] The meaning of Bayes' theorem depends on the interpretation of probability ascribed to the terms:

Frequentist interpretation

In the frequentist interpretation, probability measures the proportion of trials in which an event (a subset of the possible outcomes) occurs. Consider events A and B. Suppose we consider only trials in which A occurs. The proportion in which B also occur is P(B|A). Conversely, suppose we consider only trials in which B occurs. The proportion in which A also occur is P(A|B). Bayes' theorem links these two quantities, with P(A) and P(B) the overall proportions of trials with A and B.

The situation may be more fully visualised with tree diagrams, shown to the right. For example, suppose that some members of a population have a risk factor for a medical condition, and some have the condition. The proportion with the condition depends whether those with or without the risk factor are examined. The proportion having the risk factor depends whether those with or without the condition are examined. Bayes' theorem links these two representations.

Bayesian interpretation

In the Bayesian (or epistemological) interpretation, probability measures a degree of belief. Bayes' theorem then links the degree of belief in a proposition before and after accounting for evidence. For example, suppose somebody proposes that a biased coin is twice as likely to land heads than tails. Degree of belief in this might initially be 50%. The coin is then flipped a number of times to collect evidence. Belief may rise to 70% if the evidence supports the proposition.

For proposition A and evidence B,

  • P(A), the prior, is the initial degree of belief in A.
  • P(A|B), the posterior, is the degree of belief having accounted for B.
  • P(B|A)/P(B) represents the support B provides for A.

For more on the application of Bayes' theorem under the Bayesian interpretation of probability, see Bayesian inference.

Forms

For events

Simple form

For events A and B, provided that P(B) \ne 0.

P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. \,

In a Bayesian inference step, the probability of evidence B is constant for all models A_n. The posterior may then be expressed as proportional to the numerator:

P(A_n|B) \propto P(B|A_n) P(A_n). \,

Extended form

Often, for some partition of the event space \{A_i\}, the event space is given or conceptualized in terms of P(A_i) and P(B|A_i). It is then useful to eliminate P(B) using the law of total probability:

P(B) = {\sum_j P(B|A_j) P(A_j)}.
\implies P(A_i|B) = \frac{P(B|A_i)\,P(A_i)}{\sum\limits_j P(B|A_j)\,P(A_j)}.

In the special case of a binary partition,

P(A|B) = \frac{P(B|A)\,P(A)}{ P(B|A) P(A) %2B P(B|\neg A) P(\neg A)}.

Three or more events

Extensions to Bayes' theorem may be found for three or more events. For example, for three events, two possible tree diagrams branch in the order BCA and ABC. By repeatedly applying the definition of conditional probability:

 P(A|B \cap C) = \frac{P(A \cap B \cap C)}{P(B \cap C)} = \frac{P(C|A \cap B) \, P(A \cap B)}{P(C|B) \, P(B)} = \frac{P(C|A \cap B) \, P(B|A) \, P(A)}{P(C|B) \, P(B)}.

As previously, the law of total probability may be substituted for unknown marginal probabilities.

For random variables

Consider a sample space \Omega generated by two random variables X and Y. In principle, Bayes' theorem applies to the events A = \{X=x\} and B = \{Y=y\}. However, terms become 0 at points where either variable has finite probability density. To remain useful, Bayes' theorem may be formulated in terms of the relevant densities (see Derivation).

Simple form

If X is continuous and Y is discrete,

f_X(x|Y=y) = \frac{P(Y=y|X=x)\,f_X(x)}{P(Y=y)}

If X is discrete and Y is continuous,

 P(X=x|Y=y) = \frac{f_Y(y|X=x)\,P(X=x)}{f_Y(y)}

If both X and Y are continuous,

 f_X(x|Y=y) = \frac{f_Y(y|X=x)\,f_X(x)}{f_Y(y)}

Extended form

A continuous event space is often conceptualized in terms of the numerator terms. It is then useful to eliminate the denominator using the law of total probability. For f_Y(y), this becomes an integral:

 f_Y(y) = \int_{-\infty}^\infty f_Y(y|X=\xi )\,f_X(\xi)\,d\xi .

Bayes' rule

Under the Bayesian interpretation of probability, Bayes' rule may be thought of as Bayes' theorem in odds form.

O(A_1:A_2|B) = \Lambda(A_1:A_2|B) \cdot O(A_1:A_2)

Where

\Lambda(A_1:A_2|B) = \frac{P(B|A_1)}{P(B|A_2)}.

Derivation

For general events

Bayes' theorem may be derived from the definition of conditional probability:

P(A|B)=\frac{P(A \cap B)}{P(B)}, \text{ if } P(B) \neq 0. \!
P(B|A) = \frac{P(A \cap B)}{P(A)}, \text{ if } P(A) \neq 0. \!
\implies P(A \cap B) = P(A|B)\, P(B) = P(B|A)\, P(A). \!
\implies P(A|B) = \frac{P(B|A)\,P(A)}{P(B)}, \text{ if } P(B) \neq 0.

For random variables

For two continuous random variables X and Y, Bayes' theorem may be analogously derived from the definition of conditional density:

f_X(x|Y=y) = \frac{f_{X,Y}(x,y)}{f_Y(y)}
f_Y(y|X=x) = \frac{f_{X,Y}(x,y)}{f_X(x)}
\implies f_X(x|Y=y) = \frac{f_Y(y|X=x)\,f_X(x)}{f_Y(y)}.

Examples

Frequentist example

An entomologist spots what might be a rare subspecies of beetle, due to the pattern on its back. In the rare subspecies, 98% have the pattern. In the common subspecies, 5% have the pattern. The rare subspecies accounts for only 0.1% of the population. How likely is the beetle to be rare?

From the extended form of Bayes' theorem,

\begin{align}P(\text{Rare}|\text{Pattern}) &= \frac{P(\text{Pattern}|\text{Rare})P(\text{Rare})} {P(\text{Pattern}|\text{Rare})P(\text{Rare}) \, %2B \, P(\text{Pattern}|\text{Common})P(\text{Common})} \\[8pt]
&= \frac{0.98 \times 0.001} {0.98 \times 0.001 %2B 0.05 \times 0.999} \\[8pt]
&\approx 1.9\% \end{align}

Drug testing

Suppose a drug test is 99% sensitive and 99% specific. That is, the test will produce 99% true positive and 99% true negative results. Suppose that 0.5% of people are users of the drug. If an individual tests positive, what is the probability they are a user?


\begin{align}
P(\text{User}|\text{%2B}) &= \frac{P(\text{%2B}|\text{User}) P(\text{User})}{P(\text{%2B}|\text{User}) P(\text{User}) %2B P(\text{%2B}|\text{Non-user}) P(\text{Non-user})} \\[8pt]
&= \frac{0.99 \times 0.005}{0.99 \times 0.005 %2B 0.01 \times 0.995} \\[8pt]
&\approx 33.2\%
\end{align}

Despite the apparent accuracy of the test, if an individual tests positive, it is more likely that they do not use the drug than that they do.

This surprising result arises because the number of non-users is very large compared to the number of users, such that the number of false positives (0.995%) outweighs the number of true positives (0.495%). To use concrete numbers, if 1000 individuals are tested, there are expected to be 995 non-users and 5 users. From the 995 non-users, 0.01 \times 995 \approx 10 false positives are expected. From the 5 users, 0.99 \times 5 \approx 5 true positives are expected. Out of 15 positive results, only 5, about 33%, are genuine.

Historical remarks

Bayes' theorem was named after the Reverend Thomas Bayes (1702–61), who studied how to compute a distribution for the probability parameter of a binomial distribution (in modern terminology). His friend Richard Price edited and presented this work in 1763, after Bayes' death, as An Essay towards solving a Problem in the Doctrine of Chances.[3] The French mathematician Pierre-Simon Laplace reproduced and extended Bayes' results in 1774, apparently quite unaware of Bayes' work.[4] Stephen Stigler suggested in 1983 that Bayes' theorem was discovered by Nicholas Saunderson some time before Bayes.[5] Edwards (1986) disputed that interpretation.[6]

Bayes' preliminary results (Propositions 3, 4, and 5) imply the truth of the theorem that is named for him. Particularly, Proposition 5 gives a simple description of conditional probability:

"If there be two subsequent events, the probability of the second b/N and the probability of both together P/N, and it being first discovered that the second event has also happened, from hence I guess that the first event has also happened, the probability I am right is P/b."

However, it does not appear that Bayes emphasized or focused on this finding. He presented his work as the solution to a problem:

"Given the number of times in which an unknown event has happened and failed [... Find] the chance that the probability of its happening in a single trial lies somewhere between any two degrees of probability that can be named."[3]

Bayes gave an example of a man trying to guess the ratio of "blanks" and "prizes" at a lottery. So far the man has watched the lottery draw ten blanks and one prize. Given these data, Bayes showed in detail how to compute the probability that the ratio of blanks to prizes is between 9:1 and 11:1 (the probability is low - about 7.7%). He went on to describe that computation after the man has watched the lottery draw twenty blanks and two prizes, forty blanks and four prizes, and so on. Finally, having drawn 10,000 blanks and 1,000 prizes, the probability reaches about 97%.[3]

Bayes' main result (Proposition 9) is the following in modern terms:

Assume a uniform prior distribution of the binomial parameter p. After observing m successes and n failures,

P(a<p<b|m;n)=
\frac {\int_a^b {n%2Bm \choose m} p^m (1-p)^n\,dp}
 {\int_0^1 {n%2Bm \choose m} p^m (1-p)^n\,dp}.
\!

It is unclear whether Bayes was a "Bayesian" in the modern sense. That is, whether he was interested in Bayesian inference, or merely in probability. Proposition 9 seems "Bayesian" in its presentation as a probability about the parameter p. However, Bayes stated his question in a manner that suggests a frequentist viewpoint: he supposed that a billiard ball is thrown at random onto a billiard table, and considered further billiard balls that fall above or below the first ball with probabilities p and 1-p. The algebra is of course identical no matter which view is taken.

Stephen Fienberg describes the evolution from "inverse probability" at the time of Bayes and Laplace, a term still used by Harold Jeffreys (1939), to "Bayesian" in the 1950s.[7] Ironically, Ronald A. Fisher introduced the "Bayesian" label in a derogatory sense.

Richard Price and the existence of God

Richard Price discovered Bayes' essay and its now-famous theorem in Bayes' papers after Bayes' death. He believed that Bayes' Theorem helped prove the existence of God ("the Deity") and wrote the following in his introduction to the essay:

"The purpose I mean is, to shew what reason we have for believing that there are in the constitution of things fixt laws according to which things happen, and that, therefore, the frame of the world must be the effect of the wisdom and power of an intelligent cause; and thus to confirm the argument taken from final causes for the existence of the Deity. It will be easy to see that the converse problem solved in this essay is more directly applicable to this purpose; for it shews us, with distinctness and precision, in every case of any particular order or recurrency of events, what reason there is to think that such recurrency or order is derived from stable causes or regulations in nature, and not from any irregularities of chance." (Philosophical Transactions of the Royal Society of London, 1763)[3]

In modern terms this is an instance of the teleological argument.

See also

Notes

  1. ^ McGrayne, Sharon Bertsch. (2011). The Theory That Would Not Die, p. 10. at Google Books
  2. ^ Jaynes, Edwin T. (2003). Probability theory: the logic of science. Cambridge University Press. ISBN 9780521592710. 
  3. ^ a b c d Bayes, Thomas, and Price, Richard (1763). "An Essay towards solving a Problem in the Doctrine of Chance. By the late Rev. Mr. Bayes, communicated by Mr. Price, in a letter to John Canton, M. A. and F. R. S.". Philosophical Transactions of the Royal Society of London 53 (0): 370–418. doi:10.1098/rstl.1763.0053. http://www.stat.ucla.edu/history/essay.pdf. 
  4. ^ Daston, Lorraine (1988). Classical Probability in the Enlightenment. Princeton Univ Press. p. 268. ISBN 0-691-08497-1. 
  5. ^ Stephen M. Stigler (1983), "Who Discovered Bayes' Theorem?" The American Statistician 37(4):290–296.
  6. ^ A. W. F. Edwards (1986), "Is the Reference in Hartley (1749) to Bayesian Inference?", The American Statistician 40(2):109–110
  7. ^ Fienberg, Stephen E. (2006).When Did Bayesian Inference Become “Bayesian”?.

References

Versions of the essay

Commentaries

Additional material